Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get HummingbirdFluent working with HB 2.0 #11

Merged
merged 14 commits into from
Jan 5, 2024
Merged

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Dec 24, 2023

Remove HBApplication extensions
HBFlluent is now a Service.
Make HBFluent Sendable by

  • Making Migrations only accessible on MainActor.
  • Wrapping Databases whose access is already protected by a lock in an UnsafeTransfer.

Update HBFluentPersistDriver

public let history: History
/// List of migrations. Only accessible from the main actor
@MainActor
public var migrations: Migrations { self._migrations.value }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm currently using @MainActor here. @Joannis what are your thoughts on setting up a Hummingbird global actor in Hummingbird and using that instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you foresee other places where you'd want/need this? What's the "domain" of the actor? What type of information do you scope it to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point I time probably not so we can keep as @MainActor. The migration stuff should only be setup during initialisation.

Copy link
Member

@Joannis Joannis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't worked on or with Fluent for ages, so I'm not confident I can give a great review when it comes to API design

} catch {
return request.eventLoop.makeFailedFuture(error)
print("\(error)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print statement

} catch {
return request.eventLoop.makeFailedFuture(error)
print("\(error)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print statement

@adam-fowler
Copy link
Member Author

I haven't worked on or with Fluent for ages, so I'm not confident I can give a great review when it comes to API design

It's not like I've used it a great deal. I'm not really a fan. I basically provided this as I know a lot of people rely on it.

@adam-fowler adam-fowler merged commit a6f6454 into 2.x.x Jan 5, 2024
2 of 3 checks passed
@adam-fowler adam-fowler deleted the 2.x.x-working branch January 5, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants